(function($) {
	
	$.fn.isVerticalMiddle = function() {
		
		return $(this).each(function(){

			var $win = $(window),
				$logo = $('#logo'),
				logoHeight = $logo.height(),
				loginHeight = $('#wrap').height(),
				verticalAutoMid = function(){
					var marginTop = ($win.height() - logoHeight - loginHeight) / 3;
					
					$logo.css('margin-top', marginTop > 0 ? marginTop : 0);
				};
			
			verticalAutoMid();
			
			$win.bind('scroll resize', function() {
				verticalAutoMid();
			});
		});
	};
})(jQuery);